# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-lmdb
pkgver=1.2.1
pkgrel=4
pkgdesc="Universal Python binding for the LMDB 'Lightning' Database"
url="https://github.com/jnwatson/py-lmdb/"
arch="all"
license="OLDAP-2.8"
depends="python3"
makedepends="
	lmdb-dev
	py3-setuptools
	python3-dev
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/jnwatson/py-lmdb/archive/py-lmdb_$pkgver.tar.gz
	0001-make-map-resize-test-more-robust-for-weird-page-size-oss.patch
	"
builddir="$srcdir/py-lmdb-py-lmdb_$pkgver"

build() {
	LMDB_FORCE_SYSTEM=1 python3 setup.py build
}

check() {
	# testIterWithDeletes is broken since LMDB 0.9.2.7
	PYTHONPATH=$(echo "$PWD"/build/lib*) pytest -k 'not testIterWithDeletes'
}

package() {
	LMDB_FORCE_SYSTEM=1 python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
78f27c618ec38077cad35a5ef7ee014561d32c0e3d8d9d7bc6f0341982622c855079fa1ac7072e326f92c1a0dc4a7c84b457c7f6c7277ed9b3db0dd0ad7c5c4b  py-lmdb_1.2.1.tar.gz
1f7ed5aabd6d182d32cb1c2fe1e6db5fb7ff51b1f03828e4b593f02c12439a4d348201c5771429542ed180a20bb030fa978a21ac061179092bf1163645391c0f  0001-make-map-resize-test-more-robust-for-weird-page-size-oss.patch
"
